/***************************************************************
 * Name:      testwx4Main.h
 * Purpose:   Defines Application Frame
 * Author:     ()
 * Created:   2011-05-18
 * Copyright:  ()
 * License:
 **************************************************************/

#ifndef TESTWX4MAIN_H
#define TESTWX4MAIN_H

//(*Headers(testwx4Dialog)
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/listbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
//*)

#include <wx/timer.h>
#include "../KMNetwork/KMNetClient.h"
#include "../KMNetwork/KMNetMsgIn.h"
#include "../KMNetwork/KMNetMsgOut.h"

#include "../KMNetServer/ChatProtocol.h"

class KMNetMsgIn;
class KMNetMsgOut;

enum CBState
{
    CBAskIP,
    CBAskPort,
    CBAskUsername,
    CBWaiting,
    CBConnected
};

class testwx4Dialog: public wxDialog, public KMNetClient
{
    public:

        testwx4Dialog(wxWindow* parent,wxWindowID id = -1);
        virtual ~testwx4Dialog();

    protected:
        virtual void processMessageFromServer(KMNetMsgIn &msg);

    private:
        int mIndex;
        wxTimer *mTimer;
        static const long ID_TIMER;
        void writeBox(const wxString &str);
        CBState mState;
        wxString mIP;
        long int mPort;
        wxString mUserName;

        void sendUserName();
        void sendChat(const wxString &chat);

        //(*Handlers(testwx4Dialog)
        void OnQuit(wxCommandEvent& event);
        void OnTxtInputTextEnter(wxCommandEvent& event);
        void OnTimer(wxTimerEvent& event);
        //*)

        //(*Identifiers(testwx4Dialog)
        static const long ID_LISTBOX1;
        static const long ID_TEXTCTRL2;
        static const long ID_BUTTON1;
        //*)

        //(*Declarations(testwx4Dialog)
        wxTextCtrl* TxtInput;
        wxBoxSizer* BoxSizer2;
        wxBoxSizer* BoxSizer1;
        wxButton* BtnSend;
        wxListBox* Output;
        //*)

        DECLARE_EVENT_TABLE()
};

#endif // TESTWX4MAIN_H
